package buildcode.database.convert;

import buildcode.util.CommonUtil;

public class UnderLineToCamelCaseConvert implements NameConvert {

    @Override
    public String convert(String columnName) {
        String[] columnNameArr = columnName.split("_");
        if (columnNameArr.length == 1) {
            return columnName;
        }
        StringBuilder start = new StringBuilder(columnNameArr[0]);
        for (int i = 1; i < columnNameArr.length; i++) {
            start.append(CommonUtil.firstUpper(columnNameArr[i]));
        }
        return start.toString();
    }

}
